home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / shtdll15.zip / SPTAPP.FRM < prev    next >
Text File  |  1995-07-01  |  7KB  |  262 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Shtdll Sample Application"
  4.    ClientHeight    =   6105
  5.    ClientLeft      =   495
  6.    ClientTop       =   1305
  7.    ClientWidth     =   8700
  8.    Height          =   6765
  9.    Icon            =   SPTAPP.FRX:0000
  10.    Left            =   450
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   540
  13.    ScaleWidth      =   540
  14.    Top             =   690
  15.    Width           =   8790
  16.    Begin TextBox Text1 
  17.       BackColor       =   &H00FFFF00&
  18.       BorderStyle     =   0  'None
  19.       ForeColor       =   &H000000FF&
  20.       Height          =   255
  21.       Left            =   2040
  22.       TabIndex        =   2
  23.       Top             =   360
  24.       Width           =   1575
  25.    End
  26.    Begin PictureBox Picture1 
  27.       Align           =   1  'Align Top
  28.       Height          =   375
  29.       Left            =   0
  30.       ScaleHeight     =   345
  31.       ScaleWidth      =   8670
  32.       TabIndex        =   0
  33.       Top             =   0
  34.       Width           =   8700
  35.       Begin CommandButton Command5 
  36.          Caption         =   "Exit"
  37.          Height          =   320
  38.          Left            =   4440
  39.          TabIndex        =   7
  40.          Top             =   15
  41.          Width           =   495
  42.       End
  43.       Begin CommandButton Command4 
  44.          Caption         =   "Close"
  45.          Height          =   320
  46.          Left            =   3480
  47.          TabIndex        =   6
  48.          Top             =   15
  49.          Width           =   855
  50.       End
  51.       Begin CommandButton Command3 
  52.          Caption         =   "Read"
  53.          Height          =   320
  54.          Left            =   2640
  55.          TabIndex        =   5
  56.          Top             =   15
  57.          Width           =   735
  58.       End
  59.       Begin CommandButton Command2 
  60.          Caption         =   "Open"
  61.          Height          =   320
  62.          Left            =   1680
  63.          TabIndex        =   4
  64.          Top             =   15
  65.          Width           =   855
  66.       End
  67.       Begin CommandButton Command1 
  68.          Caption         =   "Open and Read"
  69.          Height          =   320
  70.          Left            =   60
  71.          TabIndex        =   3
  72.          Top             =   15
  73.          Width           =   1455
  74.       End
  75.    End
  76.    Begin Grid Grid1 
  77.       Cols            =   20
  78.       Height          =   5775
  79.       HighLight       =   0   'False
  80.       Left            =   0
  81.       Rows            =   20
  82.       TabIndex        =   1
  83.       Top             =   360
  84.       Width           =   8655
  85.    End
  86.    Begin Menu MnuFile 
  87.       Caption         =   "File"
  88.       Begin Menu MnuOR 
  89.          Caption         =   "Open and Read Sheet"
  90.       End
  91.       Begin Menu MnuOpen 
  92.          Caption         =   "Open Sheet File"
  93.       End
  94.       Begin Menu MnuRead 
  95.          Caption         =   "Read a Cell Value"
  96.       End
  97.       Begin Menu MnuClose 
  98.          Caption         =   "Close Sheet File"
  99.       End
  100.       Begin Menu MnuEnd 
  101.          Caption         =   "Exit"
  102.       End
  103.    End
  104.    Begin Menu MnuExit 
  105.       Caption         =   "Exit"
  106.       Begin Menu MnuQuit 
  107.          Caption         =   "Quit"
  108.       End
  109.    End
  110. End
  111. Dim A As String * 3
  112. Dim pext As String * 3, hFile As Integer
  113. Dim ggrd As grd
  114.  
  115. Sub adjwidth (grd As Grid)
  116.     For i% = 0 To grd.Cols - 1
  117.         grd.ColWidth(i%) = form1.TextWidth("ABCDEFGH")
  118.     Next
  119. End Sub
  120.  
  121. Sub Clean_grid (grd As Grid)
  122.       grd.SelStartCol = grd.FixedCols
  123.       grd.SelStartRow = grd.FixedRows
  124.       grd.SelEndCol = grd.Cols - 1
  125.       grd.SelEndRow = grd.Rows - 1
  126.  
  127.       ' Clear the cells.
  128.       grd.Clip = ""
  129. End Sub
  130.  
  131. Sub Command1_Click ()
  132. Dim A As String
  133. Dim txt As String * 256
  134. Dim filename As String * 128
  135. Clean_grid grid1
  136. hFile = opensptfile(filename, pext, "", ggrd)
  137. caption = "sheet:  " & filename
  138. Do While readsheets(hFile, pext, ggrd, txt)
  139.     If grid1.Cols < ggrd.Col + grid1.FixedCols + 1 Then grid1.Cols = ggrd.Col + grid1.FixedCols + 1
  140.     If ggrd.Col <> -1 Then grid1.Col = ggrd.Col + grid1.FixedCols
  141.     If grid1.Rows < ggrd.Row + grid1.FixedRows + 1 Then grid1.Rows = ggrd.Row + grid1.FixedRows + 1
  142.     If ggrd.Row <> -1 Then grid1.Row = ggrd.Row + grid1.FixedRows
  143.     grid1 = txt
  144. Loop
  145.  
  146. End Sub
  147.  
  148. Sub Command1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  149.     text1.Left = Command1.Left
  150.     text1 = "Open and read sheet"
  151.     text1.Width = form1.TextWidth(text1)
  152.     text1.Visible = True
  153. End Sub
  154.  
  155. Sub Command2_Click ()
  156. Dim filename As String * 128
  157.     Clean_grid grid1
  158.     hFile = opensptfile(filename, pext, "w1k", ggrd)
  159.     caption = "sheet:  " & filename
  160. End Sub
  161.  
  162. Sub Command2_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  163.     text1.Left = Command2.Left
  164.     text1 = "Open sheet"
  165.     text1.Width = form1.TextWidth(text1.Text)
  166.     text1.Visible = True
  167. End Sub
  168.  
  169. Sub Command3_Click ()
  170. Dim txt As String * 256
  171.  
  172.     i% = readsheets(hFile, pext, ggrd, txt)
  173.     If i% = 0 Then Exit Sub
  174.     If grid1.Cols < ggrd.Col + grid1.FixedCols + 1 Then grid1.Cols = ggrd.Col + grid1.FixedCols + 1
  175.     If grid1.Rows < ggrd.Row + grid1.FixedRows + 1 Then grid1.Rows = ggrd.Row + grid1.FixedRows + 1
  176.     If ggrd.Col <> -1 Then grid1.Col = ggrd.Col + grid1.FixedCols
  177.     If ggrd.Row <> -1 Then grid1.Row = ggrd.Row + grid1.FixedRows
  178.     grid1 = txt
  179.  
  180. End Sub
  181.  
  182. Sub Command3_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  183.     text1.Left = Command3.Left
  184.     text1 = "read a cell value"
  185.     text1.Width = form1.TextWidth(text1.Text)
  186.     text1.Visible = True
  187.  
  188. End Sub
  189.  
  190. Sub Command4_Click ()
  191.     i% = flclose(hFile)
  192. End Sub
  193.  
  194. Sub Command4_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  195.     text1.Left = Command4.Left
  196.     text1 = "Close sheet file"
  197.     text1.Width = form1.TextWidth(text1.Text)
  198.     text1.Visible = True
  199.  
  200. End Sub
  201.  
  202. Sub Command5_Click ()
  203.     i% = flclose(hFile)
  204.     caption = "Open Sheet Sample Code"
  205.     End
  206. End Sub
  207.  
  208. Sub Command5_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  209.     text1.Left = Command5.Left
  210.     text1 = "Exit"
  211.     text1.Width = form1.TextWidth(text1.Text)
  212.     text1.Visible = True
  213.  
  214. End Sub
  215.  
  216. Sub Form_Load ()
  217.     adjwidth grid1
  218.     grid1.Top = picture1.Height
  219.     grid1.Height = ScaleHeight - grid1.Top
  220.     grid1.Width = ScaleWidth
  221.     text1.Visible = False
  222. End Sub
  223.  
  224. Sub Form_Resize ()
  225.     grid1.Top = picture1.Height
  226.     grid1.Height = ScaleHeight - grid1.Top
  227.     grid1.Width = ScaleWidth
  228. End Sub
  229.  
  230. Sub Grid1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  231.     text1.Visible = False
  232. End Sub
  233.  
  234. Sub MnuClose_Click ()
  235.     Command4_Click
  236. End Sub
  237.  
  238. Sub MnuEnd_Click ()
  239.     End
  240. End Sub
  241.  
  242. Sub MnuOpen_Click ()
  243.     Command2_Click
  244. End Sub
  245.  
  246. Sub MnuOR_Click ()
  247.     Command1_Click
  248. End Sub
  249.  
  250. Sub MnuQuit_Click ()
  251.     Command5_Click
  252. End Sub
  253.  
  254. Sub MnuRead_Click ()
  255.     Command3_Click
  256. End Sub
  257.  
  258. Sub Text1_KeyPress (KEYASCII As Integer)
  259.     KEYASCII = 0
  260. End Sub
  261.  
  262.